function video(tbl){
	var pager=$pager("video",null,1,10)
	return pager;
}
function video_addplay(){
	var api=Java.type("com.jse.plug.AliyunApi");
	var map=new NutMap();
	var list=$list("video","PlayInfo is NULL");
	list.forEach(function(x){
		map.put("VideoId",x.VideoId)
		map.put("Formats","mp4")
	var body=api.exec("GetPlayInfo",map)
	var rtv=foJson(body);
	dao.update("video",Chain.make("PlayInfo",rtv.PlayInfoList.PlayInfo),Cnd.where("id","=",x.id))
	})
}
/**
 * 同步视频
 */
function video_sync(tbl){
	var api=Java.type("com.jse.plug.AliyunApi");
	var map=new NutMap();
	map.put("Status","Normal")
	map.put("PageNo","1")
	map.put("PageSize","2")
	var body=api.exec("GetVideoList",map)
	print(body)
	var rtv=foJson(body)
	var num=0;//$count("video")
	var sum=num;
	if(rtv.Total>num){
		if(parseInt(rtv.Total)>1){
			for (var i = 1; i <= Math.ceil(rtv.Total/100); i++) {
				if(sum==parseInt(rtv.Total)){
					break;
				}
				map.put("PageNo",i+"")
				map.put("PageSize","100")
				body=api.exec("GetVideoList",map)
				rtv=foJson(body);
				var list=rtv.VideoList.Video;
				list.forEach(function(x){
					map.put("VideoId",x.VideoId)
					map.put("Formats","mp4")
					body=api.exec("GetPlayInfo",map)
					rtv=foJson(body);
					x.put("PlayInfo",rtv.PlayInfoList.PlayInfo)
					x.put(".table","video")
					try {
						dao.insert(x)
						sum++;
					} catch (e) {
						print(e)
					}
					
				})
			}
		}
	}
	return sum;
}
//播放地址
function video_playurl(tbl){
	
	var api=Java.type("com.jse.plug.AliyunApi");
	var map=new NutMap();
	map.put("VideoId","02e103f0631547a49bf524196154ff21")
	map.put("Formats","mp4")
//	map.put("AuthTimeout","1800")
	var body=api.exec("GetPlayInfo",map)
	var rtv=foJson(body)
	print(rtv.PlayInfoList.PlayInfo[0].PlayURL)
}
//播放凭证
function video_play(tbl){
	var api=Java.type("com.jse.plug.AliyunApi");
	var map=new NutMap();
	map.put("VideoId","02e103f0631547a49bf524196154ff21")
//	map.put("Formats","mp4")
//	map.put("AuthTimeout","1800")
	var body=api.exec("GetVideoPlayAuth",map)
	var rtv=foJson(body)
	print(rtv.PlayAuth)
}
